home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / earcd / misc / emu / arosdev.lha / AROS / rom / utility / releasenamedobject.c < prev    next >
C/C++ Source or Header  |  1997-01-27  |  2KB  |  97 lines

  1. /*
  2.     $Id: releasenamedobject.c,v 1.3 1997/01/27 13:17:14 digulla Exp $
  3.     $Log: releasenamedobject.c,v $
  4.     Revision 1.3  1997/01/27 13:17:14  digulla
  5.     Added #include <proto/exec.h>
  6.  
  7.     Revision 1.2  1997/01/27 00:32:32  ldp
  8.     Polish
  9.  
  10.     Revision 1.1  1996/12/18 01:27:36  iaint
  11.     NamedObjects
  12.  
  13.     Desc: ReleaseNamedObject()
  14.     Lang: english
  15. */
  16. #include <proto/exec.h>
  17. #include "utility_intern.h"
  18.  
  19. /*****************************************************************************
  20.  
  21.     NAME */
  22.     #include <proto/utility.h>
  23.  
  24.     AROS_LH1(void, ReleaseNamedObject,
  25.  
  26. /*  SYNOPSIS */
  27.     AROS_LHA(struct NamedObject *, object, A0),
  28.  
  29. /*  LOCATION */
  30.     struct UtilityBase *, UtilityBase, 43, Utility)
  31.  
  32. /*  FUNCTION
  33.     Releases a NamedObject that you previously obtained by calling
  34.     FindNamedObject.
  35.  
  36.     INPUTS
  37.     object        -    The NamedObject to release.
  38.  
  39.     RESULT
  40.     The NamedObject will be released from your possession, and if it
  41.     is ready to be deallocated, then the NamedObject will be freed.
  42.  
  43.     NOTES
  44.     WARNING: You really should actually have found the NamedObject
  45.         first (that is with FindNamedObject()) before calling this
  46.         function. Failure to take heed of this will cause memory
  47.         use problems.
  48.  
  49.     EXAMPLE
  50.     struct NamedObject *nObj, *myNameSpace;
  51.  
  52.     if( nObj = FindNamedObject( myNameSpace, "Some Name", NULL ) )
  53.     {
  54.         \*
  55.         Here you do whatever you want. However The NamedObject
  56.         structure should generally be treated READ-ONLY
  57.         *\
  58.  
  59.         ReleaseNamedObject( nObj );
  60.     }
  61.  
  62.     BUGS
  63.  
  64.     SEE ALSO
  65.     utility/name.h, utility/FindNamedObject()
  66.  
  67.     INTERNALS
  68.  
  69.     HISTORY
  70.     29-10-95    digulla automatically created from
  71.                 utility_lib.fd and clib/utility_protos.h
  72.     11-08-96    iaint   Adapted for AROS 1.5+.
  73.     18-10-96    iaint   Changed for different format NamedObjects.
  74.  
  75. *****************************************************************************/
  76. {
  77.     AROS_LIBFUNC_INIT
  78.  
  79.     struct IntNamedObject *no;
  80.  
  81.     if( object )
  82.     {
  83.     Forbid();
  84.     no = GetIntNamedObject( object );
  85.  
  86.     /* if(no more users) */
  87.     if( --no->no_UseCount == 0 )
  88.     {
  89.         if( no->no_FreeMessage )    RemNamedObject( object, NULL );
  90.     }
  91.     Permit();
  92.     }
  93.  
  94.     AROS_LIBFUNC_EXIT
  95.  
  96. } /* ReleaseNamedObject */
  97.